package Graph;

class Queue {
	private int maxsize,front,rear,nElem;
	private int[] a;
	
	public Queue(int s) {
		this.maxsize = s;
		this.a = new int[this.maxsize];
		this.front = 0;
		this.rear = -1;
		this.nElem = 0;
	}
	
	public void insert(int value) {
		if(this.rear == this.maxsize-1) {
			rear = -1;
		}
		
		this.a[++this.rear] = value;
		this.nElem++;
	}
	
	public int remove() {
		int temp = this.a[this.front++];
		
		if(this.maxsize == this.front) {
			this.front = 0;
		}
		
		this.nElem--;
		
		return temp;
	}
	
	public int peekFront() {
		return this.a[this.front];
	}
	
	public boolean isEmpty() {
		return (this.nElem == 0);
	}
	
	public boolean isFull() {
		return (this.nElem == this.maxsize);
	}
	
	public int size() {
		return this.nElem;
	}
}
